﻿<UserControl x:Class="ModernUILogViewer.Pages.LogTail"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mui="http://firstfloorsoftware.com/ModernUI"
             xmlns:view="clr-namespace:ModernUILogViewer.View"
             xmlns:content="clr-namespace:ModernUILogViewer.Content"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"                
             xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"                
             DataContext="{Binding Source={StaticResource mainVM}, Path=TailLogVM}"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <DockPanel>
            <Grid DockPanel.Dock="Top">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <StackPanel Orientation="Horizontal" >
                    <mui:ModernButton 
                        ToolTip="Open file"
                        Command="{Binding OpenLogFileDialogCommand}" 
                        EllipseDiameter="24" IconWidth="16" IconHeight="16"                           
                        VerticalAlignment="Top"
                        IconData="F1 M 19,50L 28,34L 63,34L 54,50L 19,50 Z M 19,28.0001L 35,28C 36,25 37.4999,24.0001 37.4999,24.0001L 48.75,24C 49.3023,24 50,24.6977 50,25.25L 50,28L 53.9999,28.0001L 53.9999,32L 27,32L 19,46.4L 19,28.0001 Z"              
                    />
                    <mui:ModernButton 
                        ToolTip="Clear content"
                        Command="{Binding ClearContentCommand}" 
                        EllipseDiameter="24" IconWidth="16" IconHeight="16"                           
                        VerticalAlignment="Top"
                        IconData="F1 M 43,30L 50.75,30L 43,22.25L 43,30 Z M 52,34L 39,34L 39,21L 24,21L 24,39L 20,43L 20,17L 43.25,17L 56,29.75L 56,59L 36.5,59L 40.5,55L 52,55L 52,34 Z M 35.1379,40.67L 38.4967,44.0287L 32.8988,49.6266L 38.4967,55.2246L 35.1379,58.5833L 29.54,52.9854L 23.9421,58.5833L 20.5833,55.2246L 26.1813,49.6266L 20.5833,44.0287L 23.9421,40.67L 29.54,46.2679L 35.1379,40.67 Z "              
                    />
                    <mui:ModernButton
                        ToolTip="Autoscroll to last line"
                        EllipseDiameter="24" IconWidth="16" IconHeight="16"                           
                        VerticalAlignment="Top"
                        Command="{Binding ToggleAutoScrollLastLineCommand}"
                        >
                        <mui:ModernButton.Style>
                            <Style TargetType="mui:ModernButton">
                                <Setter Property="IconData" Value="F1 M 22.1698,36.4215L 25.3366,36.4215L 25.3367,31.6711C 25.3367,24.6745 31.0085,19.0027 38.0051,19.0027C 45.0017,19.0027 50.6735,24.6745 50.6735,31.6711L 45.9228,31.6711C 45.9228,27.2982 42.3779,23.7533 38.0051,23.7533C 33.6322,23.7533 30.0873,27.2982 30.0873,31.6711L 30.0873,36.4216L 53.8408,36.4215L 53.8409,57.008L 22.1698,57.008L 22.1698,36.4215 Z "></Setter>
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding AutoScrollLastLine}" Value="False">
                                        <Setter Property="IconData" Value="F1 M 22.17,36.4216L 25.3369,36.4216L 25.3369,31.6711C 25.3369,24.6745 31.0087,19.0027 38.0053,19.0027C 45.0019,19.0027 50.6737,24.6745 50.6737,31.6711L 50.6737,36.4216L 53.841,36.4216L 53.8411,57.008L 22.17,57.008L 22.17,36.4216 Z M 45.9231,31.6711C 45.9231,27.2982 42.3782,23.7533 38.0053,23.7533C 33.6324,23.7533 30.0875,27.2982 30.0875,31.6711L 30.0875,36.4216L 45.923,36.4216L 45.9231,31.6711 Z "></Setter>                                        
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </mui:ModernButton.Style>
                        <i:Interaction.Triggers>                            
                            <ei:DataTrigger Binding="{Binding AutoScrollLastLine}" Value="True">
                                <!--<ei:ChangePropertyAction-->                                 
                            </ei:DataTrigger>
                        </i:Interaction.Triggers>
                    </mui:ModernButton>
                </StackPanel>
                <StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Right">
                    <mui:ModernButton 
                        ToolTip="Help online"
                        Command="{x:Static view:ViewCommands.OpenUrl}" 
                        CommandParameter="{StaticResource filewatcherurl}"
                        EllipseDiameter="24" IconWidth="16" IconHeight="16"                           
                        VerticalAlignment="Top"
                        Margin="{StaticResource DefaultRightMargin}"
                        IconData="{StaticResource helpPathData}"              
                    />
                </StackPanel>
            </Grid>
            <Grid DockPanel.Dock="Bottom">
                <Grid.RowDefinitions>
                    <RowDefinition Height="92*" />
                    <RowDefinition Height="8*" />
                </Grid.RowDefinitions>
                <content:ContentLogTail />
                <!-- optional status -->
                <Grid Grid.Row="1">
                    <Rectangle />
                    <TextBlock Text="{Binding Status}" />
                </Grid>
            </Grid>            
        </DockPanel>
    </Grid>
</UserControl>
